/************************************************************************

								Heroes IV
					  Copyright 2000, The 3DO Company

	------------------------------------------------------------------
  						       gateway_base.h

	$Header: /game/gateway_base.h $

	$NoKeywords: $

 ************************************************************************/

#if !defined( GATEWAY_BASE_H_INCLUDED )
#define GATEWAY_BASE_H_INCLUDED

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include <string>
#include <vector>

#include "handler.h"
#include "stationary_adventure_object.h"

class	t_adventure_frame;
class   t_army;

// --------------------------------------------------------------------------
// t_gateway_base - functionality shared between gateways, teleporter
// entrances and teleporter exits
// --------------------------------------------------------------------------

class t_gateway_base : public t_stationary_adventure_object
{
public:
	// Constructor
	t_gateway_base( std::string const& model_name );

	// Member functions
	virtual std::string	get_balloon_help() const;
	std::string const &	get_identifier() const;
	virtual std::string	get_name() const;
	virtual int			get_version() const;
	virtual void	    initialize( t_adventure_map& map );
	virtual bool		read( std::streambuf&						stream, 
							  t_qualified_adv_object_type const&	type,
							  int									version );
	virtual bool		read_from_map(
							std::streambuf &		stream,
							t_progress_handler *	handler );
	virtual bool		write( std::streambuf & stream ) const;

protected:
	// Member functions
    void teleport_army( t_gateway_base const &gateway_exit, t_army *army, 
					    t_adventure_frame* frame, bool allow_trades = true,
						std::string const & success_message = "",
						t_handler_1< t_army * > success_callback = t_handler_1< t_army * >() );

private:
	// Data members
	std::string	m_identifier;	// If this is blank, then an identifier must be assigned randomly
};

// --------------------------------------------------------------------------
// t_gateway_base inline members
// --------------------------------------------------------------------------

// --------------------------------------------------------------------------
// --------------------------------------------------------------------------
inline t_gateway_base::t_gateway_base( std::string const& model_name )
	:	t_stationary_adventure_object( model_name )
{
}

// --------------------------------------------------------------------------
// --------------------------------------------------------------------------
inline std::string const & t_gateway_base::get_identifier() const
{
	return m_identifier;
}


#endif // !defined( GATEWAY_BASE_H_INCLUDED )
